package com.todo.biz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/13 20:40
 * @description
 */
@Getter
@AllArgsConstructor
public enum CollectSetTypeEnum {

    FOOD(1, "FOOD", "美食"),
    SIGHT(2, "SIGHT", "景点"),
    PLATFORM_STRATEGY(3, "PLATFORM_STRATEGY", "平台攻略"),
    USER_STRATEGY(4, "USER_STRATEGY", "用户攻略"),
    ;

    private static Map<Integer, CollectSetTypeEnum> typeMap = Arrays
            .stream(CollectSetTypeEnum.values())
            .collect(Collectors.toMap(CollectSetTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static CollectSetTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }

}
